﻿@namespace MduiBlazor
@inherits MduiComponentBase

<div class="@Classname" style="@Style" @attributes="@AdditionalAttributes">
    @if (ActivatorContent != null)
    {
        <label @onclick="@OnActivatorClicked">
            <CascadingValue Value="@this" IsFixed>
                @ActivatorContent
            </CascadingValue>
        </label>
    }
    else if (!string.IsNullOrEmpty(Title))
    {
        <MduiButton Color="@Color" OnClick="@OnActivatorClicked">
            @Title
            @if (!string.IsNullOrWhiteSpace(Icon))
            {
                <MduiIcon Icon="@Icon" />
            }
        </MduiButton>
    }
    else if (!string.IsNullOrWhiteSpace(Icon))
    {
        <MduiIconButton Icon="@Icon" Color="@Color" OnClick="@OnActivatorClicked" />
    }
    <ul class="@MenuContentClassname">
        <CascadingValue Value="@this" IsFixed>
            @ChildContent
        </CascadingValue>
    </ul>
</div>

<MduiOverlay Visible="@_isFocus" OnBackgroundClick="@(_=>_isFocus=false)" Transparent />